package meta.api.web.data.presentation.form;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

import meta.common.util.ListUtil;

public class DataListResult implements Serializable {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    @JsonProperty
    private int total;

    @JsonProperty
    private List<String> list;

    public String buildJsonResult() {
        StringBuffer sb = new StringBuffer();
        sb.append("{");
        sb.append("\"total\":").append(total).append(",");
        if (ListUtil.isEmptyList(this.list)) {
            sb.append("\"list\":[]");
        } else {
            sb.append("\"list\":").append(this.list.toString());
        }
        sb.append("}");
        return sb.toString();
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }
}
